package com.itheima.tlias.mapper;

import com.itheima.tlias.pojo.Dept;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author
 * @version 1.0.1
 * @date 2023-04-07 15:25:45
 */
@Mapper
public interface DeptMapper {

    /**
     * 新增部门
     * @param dept
     */
    @Insert("insert into dept (name, create_time, update_time)" +
            " values (#{name}, #{createTime}, #{updateTime})")
    void insert(Dept dept);

    /**
     * 根据id删除部门
     * @param id
     */
    @Delete("delete from dept where id = #{id}")
    void delete(Integer id);

    /**
     * 查询所有部门
     * @return
     */
    @Select("select * from dept")
    List<Dept> findAll();
}